﻿using IconYuan.Manager.DB;
using IconYuan.Model.Entity.Markets;
using IconYuan.Model.Entity.Users;

namespace IconYuan.Manager.Markets
{
    /// <summary>
    /// 会员优惠券
    /// </summary>
    public class UserCouponManager : BaseContext<UserCoupon>
    {
        /// <summary>
        /// 我的优惠券
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public async Task<List<UserCoupon>> GetList(int user_id, DateTime startTime, DateTime endTime)
        {
            return await Db.Queryable<UserCoupon>()
              .Where(x => x.user_id == user_id && x.start_time >= startTime)
              .ToListAsync();
        }       
    }
}
